<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <h2 id="bpx">
    我是dom
  </h2>
  <h1 class="html5">HTML5新增</h1>
</body>
<script>
  const bpx = document.getElementById('bpx')
  const bpx1 = document.getElementsByTagName('h2') // 伪数组
  console.dir(bpx)
  console.log(bpx);
  console.log(bpx1); // 伪数组
  for (let i = 0; i < bpx1.length; i++) {
    console.log(bpx1[i]);
  }

  const html5 = document.getElementsByClassName('html5')
  console.log(html5);
  const h1 = document.querySelector('h1')
  console.log(h1);
  const h1s = document.querySelectorAll('h1')
  console.log(h1s);

  // 获取body
  console.log(document.body);
  // 获取html
  console.log(document.documentElement);
</script>

</html>